package com.xs.ai.config;

import org.springframework.ai.anthropic.AnthropicChatClient;
import org.springframework.ai.anthropic.api.AnthropicApi;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class AIConfig {

    @Value("${ai.anthropic.api-key}")
    private String apiKey;

    @Value("${ai.anthropic.api-url}")
    private String apiUrl;

    @Value("${ai.anthropic.model}")
    private String model;

    @Value("${ai.anthropic.max-tokens}")
    private Integer maxTokens;

    @Bean
    public AnthropicApi anthropicApi() {
        return new AnthropicApi(apiKey);
    }

    @Bean
    public AnthropicChatClient chatClient(AnthropicApi anthropicApi) {
        return new AnthropicChatClient(anthropicApi);
    }

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
